﻿#ifndef NctiDisplayDCM3SplineSurf_H
#define NctiDisplayDCM3SplineSurf_H
#include "dcl_ncti_object.h"
#include "NctiDisplayDCM3Geometry.h"
#include "NctiDisplayDCM3Point.h"
#include "NctiDCM3Def.h"
namespace NCTI
{
	class NctiDCMEXVec3d;
	class DECL_NCTI_OBJECT NctiDisplayDCM3SplineSurf : public NctiDisplayDCM3Geometry
	{
		NCTI_DISPLAYOBJECT_FUNCTIONS(NctiDisplayDCM3SplineSurf)
	public:
		virtual ~NctiDisplayDCM3SplineSurf();
	public:
		virtual void Init();
		virtual EnumNctiResult UpdateDisplay();
	private:
		NCTI_READ_AND_WRITE_VERSION_FUN(1)
		int m_u_cp_n;
		int m_v_cp_n;
		int m_u_degree;
		int m_v_degree;
		std::vector<double> m_weights;
		std::vector<NctiDCMEXVec3d> m_cp_points;
		ncti_DCM3_bs_periodicity m_u_per;
		ncti_DCM3_bs_periodicity m_v_per;

	public:
		void InitSplineSurf(int i_u_cp_n, int i_v_cp_n, const std::vector<NctiDCMEXVec3d>& i_cp_points,
			ncti_DCM3_bs_periodicity uper = NCTI_DCM3_BS_PERIODICITY_NON_PER,
			ncti_DCM3_bs_periodicity i_vper = NCTI_DCM3_BS_PERIODICITY_NON_PER,
			int i_u_deg = 2, int i_v_deg = 2, const std::vector<double>& i_weights = {});
	public:
		virtual ncti_DCM3_g_type identify()	const override { return NCTI_DCM3_SPLINE_SURFACE; }
		virtual void transform(double i_mat[4][4]) override;
		virtual std::string describe() const override;

	public: 
		ncti_DCM3_bs_periodicity u_periodicity() const { return m_u_per; }
		ncti_DCM3_bs_periodicity v_periodicity() const { return m_v_per; }
		int u_cp_n() const { return m_u_cp_n; }
		int v_cp_n() const { return m_v_cp_n; }
		int u_degree() const { return m_u_degree; }
		int v_degree() const { return m_v_degree; }
		const std::vector<double>& weights() const { return m_weights; }
		const std::vector<NctiDCMEXVec3d>& cp_points() const { return m_cp_points; }
	};
}
#endif